# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=xsrfprobe
pkgver=575.b051d78
pkgrel=4
pkgdesc='The Prime Cross Site Request Forgery Audit and Exploitation Toolkit.'
groups=('blackarch' 'blackarch-webapp' 'blackarch-scanner')
arch=('any')
url='https://github.com/0xInfection/XSRFProbe'
license=('GPL3')
depends=('python' 'python-requests' 'python-beautifulsoup4' 'python-stringdist'
         'python-tld' 'python-yattag' 'python-httplib2' 'python-urllib3')
makedepends=('git' 'dos2unix' 'python-build' 'python-wheel' 'python-pip')
source=("$pkgname::git+https://github.com/0xInfection/XSRFProbe.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

build() {
  cd $pkgname

  python -m build --wheel --outdir="$startdir/dist"
}

package() {
  cd $pkgname

  pip install \
    --verbose \
    --disable-pip-version-check \
    --no-warn-script-location \
    --ignore-installed \
    --no-compile \
    --no-deps \
    --root="$pkgdir" \
    --prefix=/usr \
    --no-index \
    --find-links="file://$startdir/dist" \
    $pkgname

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" *.md
  install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  find "$pkgdir/" -type f -exec dos2unix {} \;
}

